<?php
namespace App\Repository;

use App\Model\Config;

class ConfigRepository extends \HyperfStore\Repository
{
    // 放入模型
    public function build()
    {
        return new Config;
    }

    // 更新配置
    public function update($data)
    {
        foreach($data as $name => $value)
        {
            $this->model->where('name', $name)->update([
                'value' => is_array($value) ? json_encode($value) : $value
            ]);
        }
    }
}